//
//  NEDFormItem.h
//  NEDFormView_Example
//
//  Created by 000 on 2022/1/7.
//  Copyright © 2022 000. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "NEDFormSectionLayout.h"
#import "NEDFormContentItem.h"

NS_ASSUME_NONNULL_BEGIN

@class NEDFormSeationView;
@class NEDFormContentItem;
@class NEDFormItem;

/// 一个元素对应一个view
/// 为headerview
/// 一个元素一个section

typedef void(^_Nullable NEDFormItemBlock)(NSInteger section, NEDFormSeationView * headerView, __kindof NEDFormItem * passItem);
typedef CGFloat(^_Nullable NEDFormItemHeightBlock)(NSInteger section, NEDFormSeationView * _Nullable headerView, __kindof NEDFormItem * passItem);

/// 每个信息元素
@interface NEDFormItem : NSObject

/// MARK: - data

/// 自定义ID类型 可用于辨析model类型
@property (copy, nonatomic) NSString * ID;
/// 关联外部的model信息
@property (retain, nonatomic) id linkDataInfo;

/// 注册可重用ID 如果不赋值就是不重用
@property (copy, nonatomic) NSString * registerReuseIdentifier;

/// 关联的section cell 上显示的数据
@property (retain, nonatomic, readonly) NSMutableArray * rowDataList;

/// 是否为必填项
@property (assign, nonatomic) BOOL isRequire;
/// 值变化之后 去自动刷新表格数据 : 默认YES
@property (assign, nonatomic) BOOL isChangeAutoReloadView;

/// 左侧显示的内容
@property (retain, nonatomic) NEDFormContentItem * leftContent;
/// 右侧显示的内容
@property (retain, nonatomic) NEDFormContentItem * rightContent;
/// 中间显示的内容
@property (retain, nonatomic) NEDFormContentItem * centerContent;

/// 布局信息
@property (retain, nonatomic) NEDFormSectionLayout * layout;


/// MARK: - action

/// 显示
@property (copy, nonatomic) NEDFormItemBlock showBlock;
/// 点击
@property (copy, nonatomic) NEDFormItemBlock clickBlock;

/// 高度计算 计算完如果为固定值 赋值到heightFix 否则每次都计算
@property (copy, nonatomic) NEDFormItemHeightBlock heightCalculationBlock;

/// 判断是否满足条件 默认YES 子类实现
/// 看是否需要Hint
- (BOOL)isAvailable;

@end

NS_ASSUME_NONNULL_END
